<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style type="text/css">
	body{overflow:auto;}
  thead tr {background-color: ActiveCaption; color: CaptionText;}
  th, td {vertical-align: top; font-family: "宋体", Arial, Helvetica, sans-serif; font-size: 9pt; padding: 3px; }
  table, td {border: 1px solid silver;}
  table {border-collapse: collapse;}
  thead .col0 {width: 20%;}
  thead .col1 {width: 75%;}
	td.col0{font-size:18px;font-weight:bold;color:#f00;}
</style>
<body class="white-bg">
    <table>
      <thead>
        <tr>
          <th class="col0">章节</th>
          <th class="col1">内容</th>
        </tr>
      </thead>
      <tbody>

        <tr>
          <td class="col0">3.2 创建Nutz 项目</td>
          <td class="col1">000</td>
        </tr>
        <tr>
          <td class="col0">3.2.1 项目工程结构</td>
          <td class="col1"><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">用&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">JavaEE&nbsp;</span>框架技术创建&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Web&nbsp;</span>项目前，最好先规划好项目工程结构，分类科学管理各种资 源。例如采用表&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">3-1&nbsp;</span>所示的项目工程结构，不同的文件夹或包（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">package</span>）中存放不同类型的 文件资源，详细情况可以参照表中的说明。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">Java&nbsp;</span>源代码文件夹&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">src&nbsp;</span>下的是包（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">package</span>），<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">package&nbsp;</span>的命名通常符合下述规则：</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">1</span>）包名由小写字母和圆点组成</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">2</span>）包的路径，一般形如：<span class="h1" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-weight: bold; font-size: 18px;">com.</span><span style="margin: 0px; padding: 0px; text-indent: 0px;">公司名</span><span class="h1" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-weight: bold; font-size: 18px;">/</span><span style="margin: 0px; padding: 0px; text-indent: 0px;">团队名</span><span class="h1" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-weight: bold; font-size: 18px;">/</span><span style="margin: 0px; padding: 0px; text-indent: 0px;">个人名</span><span class="h1" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-weight: bold; font-size: 18px;">.</span><span style="margin: 0px; padding: 0px; text-indent: 0px;">项目名</span><span class="h1" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-weight: bold; font-size: 18px;">.</span><span style="margin: 0px; padding: 0px; text-indent: 0px;">分类名……</span>，基本做到见 名知义，比如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">cn.lrw.newsnutz.pojo</span>，<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">cn&nbsp;</span>代表中国，<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">lrw&nbsp;</span>代表个人，<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">newsnutz&nbsp;</span>代表项目名称，<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">pojo&nbsp;</span>表示当前包里面存放数据库表<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">/</span>视图对应的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Java&nbsp;</span>类。</p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p class="s14" style="margin: 0pt; padding: 2pt 0px 0px 47pt; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">表&nbsp;<span class="s15" style="margin: 0px; padding: 0px; font-family: Arial, sans-serif; font-size: 9pt;">3-1&nbsp;</span>项目工程结构</p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><div style='margin:0 auto;width: 900px;'><table cellspacing="0" style="margin: 0px 0px 0px 5.894pt; padding: 0px; vertical-align: top; overflow: visible; font-family: &quot;Microsoft YaHei&quot;;font-size:16px; border-collapse: collapse;"><tbody style="margin: 0px; padding: 0px; vertical-align: top; overflow: visible;"><tr style="margin: 0px; padding: 0px; height: 18pt;"><td style="margin: 0px; padding: 0px; width: 169pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s16" style="margin: 0pt; padding: 1pt 0px 0px; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">路 径</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s16" style="margin: 0pt; padding: 1pt 0px 0px; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">说 明</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 169pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s23" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-weight: bold; font-size: 9pt;">newsnutz</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">项目名称</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 169pt; border-top-style: solid; border-top-width: 1pt; border-bottom: 1pt solid rgb(250, 211, 180); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">├─<span style="margin: 0px; padding: 0px;">src</span></p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">源码文件夹</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#FAD3B4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(250, 211, 180); border-bottom: 1pt solid rgb(250, 211, 180); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">│ ├─cn.lrw.newsnutz</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">Main&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">包，主模块，存放&nbsp;</span>MainModule<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">，</span>MainSetup&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">类</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#FAD3B4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(250, 211, 180); border-bottom: 1pt solid rgb(250, 211, 180); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">│ ├─cn.lrw.newsnutz.pojo</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">Pojo&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">包，子模块，存放数据库表</span>/<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">视图对应的&nbsp;</span>Java&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">类</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#FAD3B4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(250, 211, 180); border-bottom: 1pt solid rgb(250, 211, 180); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">│ ├─cn.lrw.newsnutz.module</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">Module&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">包，子模块，存放业务逻辑类</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#FAD3B4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(250, 211, 180); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">│ └─cn.lrw.newsnutz.utils</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">Utils&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">包，子模块，存放封装公用方法或属性的类</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 169pt; border-bottom: 1pt solid rgb(218, 237, 243); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">├─<span style="margin: 0px; padding: 0px;">conf</span></p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">存放&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">JS</span>、<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">JSON</span>、<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">Properties&nbsp;</span>等类型的配置文件</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#DAEDF3" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(218, 237, 243); border-bottom: 1pt solid rgb(218, 237, 243); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">│ ├─ioc</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">存放诸如数据源的配置文件</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#DAEDF3" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(218, 237, 243); border-bottom: 1pt solid rgb(218, 237, 243); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">│ └─dao.js</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">数据库配置文件</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#DAEDF3" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(218, 237, 243); border-bottom: 1pt solid rgb(218, 237, 243); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">│ ├─log4j.properties</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">系统日志配置文件</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#DAEDF3" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(218, 237, 243); border-bottom: 1pt solid rgb(218, 237, 243); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">│ ├─config.json</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">UEditor&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">的配置文件</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#DAEDF3" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(218, 237, 243); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">│ └─beetl.properties</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">Beetl&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">模板配置文件</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 169pt; border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">└─<span style="margin: 0px; padding: 0px;">WebRoot</span></p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">Web&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">项目根目录</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: 宋体; font-size: 9pt;"><span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">├─error</span></p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">存放异常访问提示页，如&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">403. html</span>、<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">404. html&nbsp;</span>等</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: 宋体; font-size: 9pt;"><span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">├─include</span></p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">分类存放网页中引用的&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">JS</span>、<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">CSS</span>、图像类文件资源</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;"><span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;"></span>│ ├─css</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;">&nbsp;</td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;"><span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;"></span>│ ├─js</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;">&nbsp;</td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;"><span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;"></span>│ ├─img</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;">&nbsp;</td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;"><span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;"></span>│ ├─easyui</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">EasyUI&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">框架</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;"><span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;"></span>│ └─ueditor</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">百度提供的可视化&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">HTML&nbsp;</span>编辑器</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: 宋体; font-size: 9pt;"><span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">├─upload</span></p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">存放上传的文件</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: 宋体; font-size: 9pt;"><span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">├─WEB-INF</span></p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">Java&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">的&nbsp;</span>Web&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">应用的安全目录，自动存放&nbsp;</span>class&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">文件</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;"><span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;"></span>│ ├─lib</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">存放项目需要的&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">Jar&nbsp;</span>包</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;"><span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;"></span>│ ├─web</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">存放网站中的网页文件，如&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">htm</span>、<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">html</span>、<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">jsp&nbsp;</span>等</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom: 1pt solid rgb(153, 252, 164); border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;"><span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;"></span>│ └─web.xml</p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">Web&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">工程的配置文件</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 18pt;"><td bgcolor="#99FCA4" style="margin: 0px; padding: 0px; width: 169pt; border-top: 1pt solid rgb(153, 252, 164); border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: 宋体; font-size: 9pt;"><span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">└─index. html</span></p></td><td style="margin: 0px; padding: 0px; width: 254pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">Web&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">工程默认的首页文件</span></p></td></tr></tbody></table></div> </td>
        </tr>
        <tr>
          <td class="col0">3.2.2 准备Jar包和JS库</td>
          <td class="col1"><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">现在项目主要使用表&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">3-2&nbsp;</span>所示的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Jar&nbsp;</span>包，可以从各自的官方网站下载最新版本，也可以从&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Maven&nbsp;</span>中央仓库查找和下载。<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Maven&nbsp;</span>中央仓库包含了世界上大部分流行的开源项目构件的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Jar&nbsp;</span>包，有很多&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Jar&nbsp;</span>包还提供各种历史版本。</p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">当前项目还使用到一些常用的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">JS</span>（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">JavaScript</span>）库、<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">CSS&nbsp;</span>库文件，如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">jquery</span>、<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">easyui</span>、<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">ueditor&nbsp;</span>等，它们都可以从官方网站下载到本地计算机上，也可以通过&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">BootCDN&nbsp;</span>网站提供的下载地址 下载。</p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p class="s14" style="margin: 0pt; padding: 2pt 0px 0px 5pt; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">表&nbsp;<span class="s15" style="margin: 0px; padding: 0px; font-family: Arial, sans-serif; font-size: 9pt;">3-2&nbsp;</span>项目所需的主要&nbsp;<span class="s15" style="margin: 0px; padding: 0px; font-family: Arial, sans-serif; font-size: 9pt;">Jar&nbsp;</span>包</p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><div style='margin:0 auto;width: 900px;'><table cellspacing="0" style="margin: 0px 0px 0px 5.294pt; padding: 0px; vertical-align: top; overflow: visible; font-family: &quot;Microsoft YaHei&quot;;font-size:16px; border-collapse: collapse;"><tbody style="margin: 0px; padding: 0px; vertical-align: top; overflow: visible;"><tr style="margin: 0px; padding: 0px; height: 18pt;"><td style="margin: 0px; padding: 0px; width: 101pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s22" style="margin: 0pt; padding: 1pt 0px 0px 25pt; font-family: Arial, sans-serif; font-size: 9pt;">Jar&nbsp;<span class="s16" style="margin: 0px; padding: 0px; font-family: 黑体, monospace; font-size: 9pt;">包的名称</span></p></td><td style="margin: 0px; padding: 0px; width: 322pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s16" style="margin: 0pt; padding: 1pt 0px 0px; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">说 明</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 101pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">Nutz</p></td><td style="margin: 0px; padding: 0px; width: 322pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">一组轻便小型的框架集合</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 101pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">mysql-connector-java</p></td><td style="margin: 0px; padding: 0px; width: 322pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt;">MySQL&nbsp;<span class="s18" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 9pt;">数据库驱动</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 101pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">druid</p></td><td style="margin: 0px; padding: 0px; width: 322pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">数据库连接池&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">Druid</span>，带强大的监控功能</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 101pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">Log4j</p></td><td style="margin: 0px; padding: 0px; width: 322pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">用&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">Java&nbsp;</span>编写的可靠，快速和灵活的日志框架</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 101pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">beetl</p></td><td style="margin: 0px; padding: 0px; width: 322pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">一款超高性能的&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">Java&nbsp;</span>模板引擎</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 101pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">shiro</p></td><td style="margin: 0px; padding: 0px; width: 322pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">用于认证、授权、加密、会话管理、与&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">Web&nbsp;</span>集成、缓存等</p></td></tr><tr style="margin: 0px; padding: 0px; height: 29pt;"><td style="margin: 0px; padding: 0px; width: 101pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p class="s17" style="margin: 0pt; padding: 0px 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">ueditor</p></td><td style="margin: 0px; padding: 0px; width: 322pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 1pt 5pt 0px; font-family: 宋体; font-size: 9pt; line-height: 12pt;">百度在线编辑器。依赖&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">json.jar</span>、<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">commons-codec-1.10.jar</span>、<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">commons-io-2.4.jar</span>、&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">commons-fileupload-1.3.3.jar</span>、<span class="s17" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">commons-lang3-3.2.1.jar</span></p></td></tr></tbody></table></div><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;">建议建一个专门的文件夹，把下载的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Jar&nbsp;</span>包和&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">JS&nbsp;</span>库、<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">CSS&nbsp;</span>库等资源集中存放，便于以后 其他项目的开发。</p> </td>
        </tr>
        <tr>
          <td class="col0">3.2.3 新建Web项目</td>
          <td class="col1"><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 26pt; font-size: 18px;"></p><p><span style="font-family:宋体;">运行</span>MyEclipse2015<span style="font-family:宋体;">，选择</span>File<span style="font-family:宋体;">菜单中的</span>New…<span style="font-family:宋体;">，点击</span>Web Project<span style="font-family:宋体;">，打开</span>New Web Project<span style="font-family:宋体;">窗口，如图</span>3-1<span style="font-family:宋体;">所示，设置基本参数。</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>Project name<span style="font-family:宋体;">：输入适当的项目名称，比如</span>newsnutz<span style="font-family:宋体;">，建议项目名称由字母或字母数字组成，名称短小但见名知义。</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>JavaEE version<span style="font-family:宋体;">：选择</span>MyEclipse2015<span style="font-family:宋体;">中最新的</span>JavaEE7<span style="font-family:宋体;">，对应</span>web3.1<span style="font-family:宋体;">的版本。</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>Java version<span style="font-family:宋体;">：选择本机安装的</span>1.8<span style="font-family:宋体;">版本。</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>JSTL version<span style="font-family:宋体;">：由于当前项目，不使用</span>jsp<span style="font-family:宋体;">页面，所以</span>JSTLversion<span style="font-family:宋体;">选择</span>none<span style="font-family:宋体;">，也就是不需要</span>JSTL<span style="font-family:宋体;">支持。</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>Target runtime<span style="font-family:宋体;">：选择运行环境为本机安装的</span>Tomcat8.0<span style="font-family:宋体;">。</span></p><br /><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 26pt; font-size: 18px;"><br /></p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 84pt; text-indent: 0px;  font-size: 9pt; line-height: 10pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_016.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 3pt 0px 0px 5pt; text-indent: 0px; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px;  font-size: 9pt;">3-1 New Web Project&nbsp;</span>窗口</p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-size: 18px; line-height: 28px; text-align: justify;">设置完成上述参数后，单击&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Next</span>，进入源文件夹（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Source Folder</span>）配置窗口，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">3-2&nbsp;</span>所 示。在当前窗口，可以看到&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">src&nbsp;</span>中的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">java&nbsp;</span>文件在经过编译后，默认输出文件夹（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Default Output Folder</span>）为&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">WebRoot\WEB-INF\classes</span>。根据项目工程结构，<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">conf&nbsp;</span>文件夹中的配置文件也应该 输出到&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">WebRoot\WEB-INF\classes&nbsp;</span>目录，所以在这个窗口中，单击&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Add Folder</span>，添加文件夹&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">conf</span>。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 97pt; text-indent: 0px;  font-size: 9pt; line-height: 10pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_017.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 3pt 0px 0px 5pt; text-indent: 0px; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px;  font-size: 9pt;">3-2 Source folders on build path&nbsp;</span>窗口</p><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 5pt; text-indent: 21pt; font-size: 18px; line-height: 28px;">存放配置文件的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">conf&nbsp;</span>文件夹添加完成后，单击&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Next&nbsp;</span>按钮进入模块配置（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Web Module</span>）窗 口，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">3-3&nbsp;</span>所示。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 97pt; text-indent: 0px;  font-size: 9pt; line-height: 10pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_018.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 5pt 0px 0px 4pt; text-indent: 0px; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px;  font-size: 9pt;">3-3 Web Module&nbsp;</span>窗口</p><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 5pt; text-indent: 21pt; font-size: 18px; line-height: 28px;">在模块配置窗口，勾选&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Generate web.xml deployment descriptor</span>，单击&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Finish</span>，生成以&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">newsnutz&nbsp;</span>为名称的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Web&nbsp;</span>项目，项目结构如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">3-4&nbsp;</span>所示，其中在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">WebRoot\WEB-INF&nbsp;</span>目录下可以 看到自动生成的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Web&nbsp;</span>项目配置文件&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">web.xml</span>。此文件主要用于配置欢迎页&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">welcome-file</span>、<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Filter</span>、&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Listener</span>、<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Servlet&nbsp;</span>等。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 142pt; text-indent: 0px;  font-size: 9pt; line-height: 10pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_019.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 5pt; text-indent: 0px; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px;  font-size: 9pt;">3-4&nbsp;</span>项目结构</p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-size: 18px; line-height: 28px; text-align: justify;">将准备好的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">Jar&nbsp;</span>包添加到&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">WebRoot/WEB-INF/lib&nbsp;</span>目录下，效果如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">3-5&nbsp;</span>所示。百度编辑器 的压缩包中包含了&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">commons-fileupload-1.3.1.jar</span>，百度官方声称&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">commons-fileupload-1.3.1.jar&nbsp;</span>存 在漏洞可能会导致&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">DDoS&nbsp;</span>攻击，强烈推荐升级至最新版本&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px;  font-size: 18px;">commons-fileupload-1.3.3.jar</span>。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 139pt; text-indent: 0px;  font-size: 9pt; line-height: 10pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_020.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 47pt; text-indent: 0px; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px;  font-size: 9pt;">3-5&nbsp;</span>添加了&nbsp;<span class="p" style="margin: 0pt; padding: 0px;  font-size: 9pt;">Jar&nbsp;</span>包的&nbsp;<span class="p" style="margin: 0pt; padding: 0px;  font-size: 9pt;">lib&nbsp;</span>目录</p><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 5pt; text-indent: 0px; font-size: 18px; text-align: center;">参照“项目工程结构”添加包（<span class="s6" style="margin: 0px; padding: 0px;  font-size: 18px;">package</span>）和其他文件夹，完成效果如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px;  font-size: 18px;">3-6&nbsp;</span>所示。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px;  font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 153pt; text-indent: 0px;  font-size: 9pt; line-height: 10pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_021.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 5pt; text-indent: 0px; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px;  font-size: 9pt;">3-6&nbsp;</span>项目结构</p>  </td>
        </tr>
        <tr>
          <td class="col0">3.2.4 添加数据源</td>
          <td class="col1"><p><span style="font-family:宋体;">利用可视化工具</span>HeidiSQL<span style="font-family:宋体;">，创建数据库</span><strong><span style="color:red;">dbnews1</span></strong><span style="font-family:宋体;">，特别注意在创建数据库时，保证数据库的字符集是</span>utf8<span style="font-family:宋体;">，选择</span>Collation<span style="font-family:宋体;">的值</span><strong><span style="color:red;">utf8_general_ci</span></strong><span style="font-family:宋体;">，如图</span>3-7<span style="font-family:宋体;">所示。</span></p><p><img th:src="@{/assets/javaeeimg/Image_022.png}" alt="" /></p><p><span style="font-family:宋体;">图</span>3-7<span style="font-family:宋体;">新建数据库</span></p><p><span style="font-family:宋体;">软件国际化是大势所趋，所以</span>Unicode<span style="font-family:宋体;">是国际化最佳的选择。</span>MySQL<span style="font-family:宋体;">有两个支持</span>Unicode<span style="font-family:宋体;">的</span>character set<span style="font-family:宋体;">，</span>ucs2<span style="font-family:宋体;">和</span>utf8<span style="font-family:宋体;">，一般选择</span>utf8<span style="font-family:宋体;">。</span></p><p><span style="font-family:宋体;">每个</span>characterset<span style="font-family:宋体;">会对应一定数量的</span>collation<span style="font-family:宋体;">，</span>collation<span style="font-family:宋体;">即比对方法，用于指定数据集如何排序，以及字符串的比对规则。</span></p><p>collation<span style="font-family:宋体;">名字的规则可以归纳为这两类：</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>&lt;character set&gt;_&lt;language/other&gt;_&lt;ci/cs&gt;</p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>&lt;character set&gt;_bin</p><p><span style="font-family:宋体;">例如：</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>utf8_ general _ci</p><p>ci<span style="font-family:宋体;">是</span>case insensitive<span style="font-family:宋体;">的缩写，</span>cs<span style="font-family:宋体;">是</span>casesensitive<span style="font-family:宋体;">的缩写。即，指定大小写是否敏感。</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>utf8_bin</p><p><span style="font-family:宋体;">是将字符串中的每一个字符用二进制数据存储，区分大小写。</span></p><p><span style="font-family:宋体;">选择了</span>Collation<span style="font-family:宋体;">，也就确定了字符集。例如选择</span>utf8_ general _ci<span style="font-family:宋体;">，就确定了字符集是</span>utf8<span style="font-family:宋体;">。</span></p><p><span style="font-family:宋体;">创建数据库以后，根据第</span>2<span style="font-family:宋体;">章中表</span>2-1<span style="font-family:宋体;">所示的表结构，在</span>dbnews1<span style="font-family:宋体;">数据库中创建</span><strong><span style="color:red;">user</span></strong><span style="font-family:宋体;">表，如图</span>3-8<span style="font-family:宋体;">所示：</span></p><p><img th:src="@{/assets/javaeeimg/Image_023.png}" class="wordImage" width="430" height="260" alt="" /></p><p><span style="font-family:宋体;">图</span>3-8<span style="font-family:宋体;">创建</span><strong><span style="color:red;">user</span></strong><span style="font-family:宋体;">表</span></p><p><span style="font-family:宋体;">根据第</span>2<span style="font-family:宋体;">章中表</span>2-2<span style="font-family:宋体;">所示的</span>news<span style="font-family:宋体;">表结构、表</span>2-3<span style="font-family:宋体;">所示的</span>cmenu<span style="font-family:宋体;">表结构，用类似的方法在</span>dbnews1<span style="font-family:宋体;">数据库中创建</span>news<span style="font-family:宋体;">表、</span>cmenu<span style="font-family:宋体;">表。</span></p><p>cmenu<span style="font-family:宋体;">中数据的组织是按</span>id<span style="font-family:宋体;">和</span>pid<span style="font-family:宋体;">标识层次关系，</span>name<span style="font-family:宋体;">值为显示在界面上菜单名称，</span>url<span style="font-family:宋体;">为请求打开指定功能的页面的路径，</span>permission<span style="font-family:宋体;">设定为指定角色的用户才能看到相应的菜单项。目前可以指定以下菜单栏目，由于系统简化了功能，这一部分数据，如表</span>3-3<span style="font-family:宋体;">所示，通过</span>HeidiSQL<span style="font-family:宋体;">等可视化工具直接录入数据库的</span>cmenu<span style="font-family:宋体;">表。</span></p><p><span style="font-family:黑体;">表</span>3-3 cmenu<span style="font-family:黑体;">表数据</span></p><div><table border="1" cellspacing="0" cellpadding="0" width="511"> <thead>  <tr><td style="width:47.25pt;"><p>id</p></td><td style="width:62.25pt;"><p>pid</p></td><td style="width:89.35pt;"><p>name</p></td><td style="width:99.25pt;"><p>url</p></td><td style="width:3.0cm;"><p>permission</p></td></tr></thead> <tbody><tr><td style="width:47.25pt;"><p>1</p></td><td style="width:62.25pt;"><p>0</p></td><td style="width:89.35pt;"><p><span style="font-family:宋体;">新闻管理</span></p></td><td style="width:99.25pt;"><p>&nbsp;</p></td><td style="width:3.0cm;"><p>1</p></td></tr><tr><td style="width:47.25pt;"><p>2</p></td><td style="width:62.25pt;"><p>1</p></td><td style="width:89.35pt;"><p><span style="font-family:宋体;">新闻列表</span></p></td><td style="width:99.25pt;"><p>/news/goList</p></td><td style="width:3.0cm;"><p>1</p></td></tr><tr><td style="width:47.25pt;"><p>3</p></td><td style="width:62.25pt;"><p>1</p></td><td style="width:89.35pt;"><p><span style="font-family:宋体;">添加新闻</span></p></td><td style="width:99.25pt;"><p>/news/goAdd</p></td><td style="width:3.0cm;"><p>1</p></td></tr></tbody></table></div><p>&nbsp;</p><p><span style="font-family:宋体;">在</span>conf/ioc<span style="font-family:宋体;">创建</span><span style="color:red;">dao.js</span><span style="font-family:宋体;color:red;">文件</span><span style="font-family:宋体;">，该文件的主要作用是创建</span>dataSource<span style="font-family:宋体;">，配置项及说明如图</span>3-9<span style="font-family:宋体;">所示。这是</span>Nutz<span style="font-family:宋体;">项目中最常见的配置方式，由</span>NutIoc<span style="font-family:宋体;">来管理</span>dataSource<span style="font-family:宋体;">和</span>NutDao<span style="font-family:宋体;">的实例</span>dao<span style="font-family:宋体;">。</span></p><p>JavaEE<span style="font-family:宋体;">的很多项目中，用到<strong>控制反转</strong></span><strong>IoC</strong><span style="font-family:宋体;">，</span>IoC<span style="font-family:宋体;">是</span>Inversion ofControl<span style="font-family:宋体;">的缩写，是面向对象编程中的一种设计思想，可以用来减低计算机代码之间的耦合度。是将对象的控制权进行转移，转移给</span>IoC<span style="font-family:宋体;">容器，不直接在对象内部通过</span>new<span style="font-family:宋体;">进行创建对象，不再是程序主动去创建依赖对象，由</span>Ioc<span style="font-family:宋体;">容器查找及注入依赖对象，对象只是被动的接受依赖对象。</span></p><p>Nutz.Ioc<span style="font-family:宋体;">是将一部分关于对象的依赖关系单独存储在某种介质里，并且提供一个接口帮助使用者获得这些对象。</span>Nutz.Ioc <span style="font-family:宋体;">核心逻辑并没有限定配置信息的存储方式，但它还是提供了一个默认的</span>JSON<span style="font-family:宋体;">或者</span>JS<span style="font-family:宋体;">配置文件，选择</span>JSON<span style="font-family:宋体;">格式，有两个优点：</span></p><p>(1)<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family:宋体;">省却了</span> XML <span style="font-family:宋体;">书写的烦恼</span></p><p>(2)<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family:宋体;">避免了硬编码，当修改了配置时，不需要重新编译工程</span></p><p><img th:src="@{/assets/javaeeimg/Image_024.png}" class="wordImage" width="567" height="295" alt="" /></p><p><span style="font-family:宋体;">图</span>3-9<span style="font-family:宋体;">创建</span>dataSource</p><p><span style="font-family:宋体;">在配置过程中，根据项目数据库的实际情况，正确设置数据库的驱动、地址、端口、数据库名、用户名和密码。</span></p><p><span style="font-family:宋体;">在设定时区的时候，如果设定</span><span style="color:red;">serverTimezone=UTC</span><span style="font-family:宋体;">，会比中国时间早</span><strong><span style="color:red;">8</span></strong><span style="font-family:宋体;">个小时；所以在中国，可以设置</span><span style="color:red;">serverTimezone=Hongkong</span></p><p><span style="font-family:宋体;">高版本</span>MySQL<span style="font-family:宋体;">，版本号高于</span>5.7<span style="font-family:宋体;">，需要指明是否进行</span>SSL<span style="font-family:宋体;">连接，如果不需要</span>SSL<span style="font-family:宋体;">连接，则设定参数</span><span style="color:red;">useSSL=false</span><span style="font-family:宋体;">，否则会在在</span>console<span style="font-family:宋体;">显示如下信息：</span></p><p><strong><span style="color:#E36C0A;background:white;">WARN: Establishing SSL connection withoutserver’s identity verification is not recommended</span></strong></p>  </td>
        </tr>
        <tr>
          <td class="col0">3.2.5 DAO注解</td>
          <td class="col1"><ul id="l9" style="margin: 0px; padding: 0px 0px 0px 0pt; font-family: microsoft yahei; font-size:16px"><li style="margin: 0px; padding: 1pt 0px 0px 47pt; text-indent: -21pt; display: block; line-height: 17.12px; text-align: left;"></li><li style="text-indent: 28px;"><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: 宋体;">在下一节开始将要涉及</span>Java<span style="font-family: 宋体;">类文件了，</span>Java<span style="font-family: 宋体;">类中会经常见到注解（</span>Annotation<span style="font-family: 宋体;">），注解在</span>Java<span style="font-family: 宋体;">类的应用，使得编程更加简洁、代码更加清晰。</span>Java<span style="font-family: 宋体;">注解是从</span>JDK1.5<span style="font-family: 宋体;">引入的，注解目前非常的流行，很多主流框架都支持注解，而且自己编写代码的时候也会尽量的去使用注解。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;">1.&nbsp;<span style="font-family: 宋体;">注解的定义</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: 宋体;">注解，它是一种代码级别的说明，与类、接口、枚举是在同一个层次，它可以声明在包、类、字段、方法、局部变量、方法参数等的前面，用来对这些元素进行说明、注释。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;">2.&nbsp;<span style="font-family: 宋体;">注解的分类</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: 宋体;">（</span>1<span style="font-family: 宋体;">）按照运行机制划分：</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">源码注解：只在源码中存在，编译成</span>.class<span style="font-family: 宋体;">文件就不存在了。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">编译时注解：在源码和</span>.class<span style="font-family: 宋体;">文件中都存在。如</span>@Override<span style="font-family: 宋体;">、</span>@Deprecated<span style="font-family: 宋体;">、</span>@SuppressWarnings<span style="font-family: 宋体;">都属于编译时注解。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">运行时注解：在运行阶段起作用，如</span>@Autowired<span style="font-family: 宋体;">自动注入，在程序运行时把成员变量自动的注入进来。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: 宋体;">（</span>2<span style="font-family: 宋体;">）按照来源划分：</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span>JDK<span style="font-family: 宋体;">的注解，主要有</span>3<span style="font-family: 宋体;">个</span>@Deprecated<span style="font-family: 宋体;">、</span>@Override<span style="font-family: 宋体;">、</span>@SuppressWarnings<span style="font-family: 宋体;">。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">第三方的注解，如</span>@Autowired<span style="font-family: 宋体;">、</span>@Inject<span style="font-family: 宋体;">、</span>@Table<span style="font-family: 宋体;">。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">自定义注解，根据需要，自己定义一些注解。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">元注解：元注解是给注解进行注解，可以理解为注解的注解，包括</span>@Retention<span style="font-family: 宋体;">、</span>@Documented<span style="font-family: 宋体;">、</span>@Target<span style="font-family: 宋体;">、</span>@Inherited<span style="font-family: 宋体;">、</span>@Repeatable<span style="font-family: 宋体;">。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: 宋体;">（</span>3<span style="font-family: 宋体;">）按照参数的个数划分：</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">标记注解，没有参数</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">单值注解，如果单值的名称是</span>value<span style="font-family: 宋体;">，则在使用时可以省略“</span>value=<span style="font-family: 宋体;">”，直接写单值。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: Wingdings;">n<span style="font-size: 7pt; font-family: Times New Roman;">&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">完整注解，定义注解时，一般会包含一些可以设置默认值的元素。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: 宋体;">注解的语法比较简单，除了</span>@<span style="font-family: 宋体;">符号的使用之外，它基本与</span>Java<span style="font-family: 宋体;">固有语法一致，比如</span>@Override<span style="font-family: 宋体;">，表示当前定义的方法将覆盖超类或接口中的方法。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: 宋体;">主流框架已经定义了很多便于使用的注解，我们更多地是关注它们的使用。使用注解最主要的部分在于对注解的处理</span>(<span style="font-family: 宋体;">注解处理器</span>)<span style="font-family: 宋体;">，注解处理器就是通过反射机制获取被检查类或方法上的注解信息，然后根据注解元素的值进行特定的处理。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: 宋体;">我们首先了解一下</span>Nutz<span style="font-family: 宋体;">框架中如表</span>3-4<span style="font-family: 宋体;">所示</span>Dao<span style="font-family: 宋体;">支持的注解。</span></p><p style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><span style="font-family: 黑体;">表</span>3-4 Nutz.Dao<span style="font-family: 黑体;">支持的全部注解</span></p><div style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"><table border="1" cellspacing="0" cellpadding="0" width="391"><tbody><tr><td style="width: 123.5pt;"><p><strong><span style="font-size:18px;color:#ff0000;"><span style="font-family: 黑体;">注</span>&nbsp;&nbsp;<span style="font-family: 黑体;">解</span></span></strong></p></td><td style="width: 6cm;"><p><span style="font-weight: bold;"><span style="font-size:18px;color:#ff0000;"><span style="font-family: 黑体;">说</span>&nbsp;&nbsp;<span style="font-family: 黑体;">明<span id="_xhe_cursor"></span></span></span></span></p></td></tr><tr><td style="width: 123.5pt; height: 15pt;"><p>@Column</p></td><td style="width: 6cm; height: 15pt;"><p><span style="font-family: 宋体;">字段</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@ColDefine</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">字段精确定义</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Default</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">默认值</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@EL</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">字段表达式宏</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Id</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">数值主键</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Name</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">字符主键</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@PK</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">复合主键</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Many</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">一对多映射</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@ManyMany</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">多对多映射</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@One</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">一对一映射</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Prev</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">自动设置</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Next</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">自动获取</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Readonly</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">只读声明</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@SQL</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">字段</span>SQL<span style="font-family: 宋体;">宏</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Table</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">表名</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@View</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">视图名</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@TableMeta</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">表设置</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@TableIndexes</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">表索引</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Index</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">具体的索引内容</span></p></td></tr><tr><td style="width: 123.5pt;"><p>@Comment</p></td><td style="width: 6cm;"><p><span style="font-family: 宋体;">表或者字段的注释</span></p></td></tr></tbody></table><br /></div><span id="_xhe_cursor" style="font-family: &quot;Microsoft YaHei&quot;;font-size:16px;"></span><br /></li><li style="margin: 0px; padding: 1pt 0px 0px 47pt; text-indent: -21pt; display: block; text-align: left;"></li></ul>  </td>
        </tr>
        <tr>
          <td class="col0">3.2.6 添加POJO类</td>
          <td class="col1"><p class="s6" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: Times New Roman, serif; font-size: 18px; line-height: 28px; text-align: justify;">Pojo<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">（</span>Plain Ordinary Java Object<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">）是指简单的&nbsp;</span>Java&nbsp;<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">对象，实际就是普通&nbsp;</span>JavaBeans<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">，仅包 含属性及其&nbsp;</span>getter/setter&nbsp;<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">方法的类，没有业务逻辑，可以理解为简单的实体类，用于封装数据 库中的数据表，</span>POJO&nbsp;<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">类对象可以方便地调用其&nbsp;</span>getter/setter&nbsp;<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">方法。</span></p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">cn.lrw.newsnutz.pojo&nbsp;</span>包中创建&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">user&nbsp;</span>数据库表对应的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">POJO&nbsp;</span>类&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">User</span>，然后添加表中字段 对应的属性和&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">getter/setter&nbsp;</span>方法。可以借助第三方工具，如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">MagicalTools</span>，批量自动生成数据库 中大量表<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">/</span>视图对应的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">POJO&nbsp;</span>类，这样可以大幅度减少编写代码的时间，提高开发效率。</p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">可以通过“附录 在线资源”中提供的网址，下载&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">MagicalTools&nbsp;</span>工具。如果已经下载，运 行&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">MagicalTools&nbsp;</span>目录中的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">run.bat&nbsp;</span>程序，将会打开一个可视化窗口，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">3-10&nbsp;</span>所示。在窗口中 进行以下操作，可批量快速生成&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">POJO&nbsp;</span>类。</p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_025.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p style="margin: 0pt; padding: 3pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 9pt; text-align: center;"><span style="font-family: 宋体; font-size: 9pt;">图&nbsp;</span><span class="p" style="font-size: 9pt; margin: 0pt; padding: 0px;">3-10 MagicalTools&nbsp;</span><span style="font-family: 宋体; font-size: 9pt;">工具自动生成&nbsp;</span><span class="p" style="font-size: 9pt; margin: 0pt; padding: 0px;">POJO&nbsp;</span><span style="font-family: 宋体; font-size: 9pt;">类</span><br /></p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 26pt; font-family: 宋体; font-size: 18px;">操作步骤：</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">1</span>）选择服务名&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">mysql</span>。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">2</span>）根据实际情况修改&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">URL&nbsp;</span>地址中的端口号，如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">3066</span>，已经存在的数据库&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">mysql</span>。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">3</span>）输入连接&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">MySQL&nbsp;</span>数据库系统的密码，然后单击“连接”按钮。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">4</span>）连接成功后，会在数据库列表中显示&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">MySQL&nbsp;</span>中的数据库名称，如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">dbnews1</span>。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">5</span>）选择&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">dbnews1</span>，就会显示&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">dbnews1&nbsp;</span>中的所有表和视图，如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">user</span>、<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">news</span>、<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">cmenu</span>。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">6</span>）选择需要生成&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">pojo&nbsp;</span>的表和视图，如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">user</span>，也可以选择全部。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;">（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">7</span>）选择模板列表中的模板“<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">java&nbsp;</span>实体<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">.tpl</span>”，也可以参照已有的模板或自定义新的模板， 如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">nutzpojo.tpl</span>。</p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">8</span>）输入项目包名，如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">cn.lrw.newsnutz.pojo</span>。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;">（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">9</span>）单击“生成代码”按钮。将在默认的保存路径&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">C:\dbinfo\entities&nbsp;</span>下生成&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">POJO&nbsp;</span>类文件， 如&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">User.java</span>。</p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">10</span>）把生成的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">POJO&nbsp;</span>类文件复制到&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">MyEclipse&nbsp;</span>的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">newsnutz&nbsp;</span>项目的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">cn.lrw.newsnutz.pojo</span></p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; font-family: 宋体; font-size: 18px;">包中。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">11</span>）打开&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">POJO&nbsp;</span>类文件，注意&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">POJO&nbsp;</span>类中使用的注解，如<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">@Table</span>，<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">@Column</span>，<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">@Id</span>，</p><p class="s6" style="margin: 0pt; padding: 1pt 0px 0px 5pt; font-family: Times New Roman, serif; font-size: 18px;">@Name<span class="s5" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 18px;">。</span></p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;">（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">12</span>）数据库表中的字段对应到&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">POJO&nbsp;</span>类中的属性，属性前的注解通常是<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">@Column</span>，标 记为字段。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">（<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">13</span>）修改、生成&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">POJO&nbsp;</span>类文件。</p><p class="s6" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 21pt; font-family: Times New Roman, serif; font-size: 18px; line-height: 28px;">1<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">）“主键”属性前的注解应该为</span>@Id (<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">数值型主键</span>)<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">或</span>@Name (<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">字符型主键</span>)<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">，如图&nbsp;</span>3-11&nbsp;<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">所 示，新闻的&nbsp;</span>id&nbsp;<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">是整数类型，所以注解修改为</span>@Id<span class="s5" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: 宋体; font-size: 18px;">。</span></p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 138pt; font-family: Times New Roman, serif; font-size: 9pt; line-height: 10pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_026.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 6pt 0px 0px 5pt; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">3-11 MagicalTools&nbsp;</span>生成的&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">POJO&nbsp;</span>类</p><p class="s6" style="margin: 0pt; padding: 7pt 0px 0px 26pt; font-family: Times New Roman, serif; font-size: 18px;">2<span class="s5" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 18px;">）将属性&nbsp;</span>tjdate&nbsp;<span class="s5" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 18px;">的日期类型&nbsp;</span>java.sql.Timestamp&nbsp;<span class="s5" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 18px;">修改为&nbsp;</span>java.util.Date<span class="s5" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 18px;">，还要相应修改&nbsp;</span>tjdate</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; font-family: 宋体; font-size: 18px;">的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">getter/setter&nbsp;</span>方法。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;">修改之后，如果文件中报错，使用快捷键&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Ctrl+Shift+O&nbsp;</span>自动整理&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">import&nbsp;</span>引入的包，消除 报错。修改完成后，保存文件。</p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;">补充：在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Web&nbsp;</span>开发中，避免不了对日期的操作，要注意表&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">3-5&nbsp;</span>所示的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">4&nbsp;</span>种常见日期类的 区别。</p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p class="s14" style="margin: 0pt; padding: 0px 0px 0px 21pt; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">表&nbsp;<span class="s15" style="margin: 0px; padding: 0px; font-family: Arial, sans-serif; font-size: 9pt;">3-5 Java&nbsp;</span>日期类的区别</p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><div style='margin:0 auto;width: 900px;'><table cellspacing="0" style="margin: 0px 0px 0px 5.29399pt; padding: 0px; vertical-align: top; overflow: visible; font-family: &quot;Microsoft YaHei&quot;;font-size:16px; border-collapse: collapse;"><tbody style="margin: 0px; padding: 0px; vertical-align: top; overflow: visible;"><tr style="margin: 0px; padding: 0px; height: 18pt;"><td style="margin: 0px; padding: 0px; width: 141pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s16" style="margin: 0pt; padding: 1pt 0px 0px; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">日期类</p></td><td style="margin: 0px; padding: 0px; width: 282pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s16" style="margin: 0pt; padding: 1pt 0px 0px; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">日期格式</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 141pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">java.util.Date</p></td><td style="margin: 0px; padding: 0px; width: 282pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">年月日时分秒</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 141pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">java.sql.Date</p></td><td style="margin: 0px; padding: 0px; width: 282pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">年月日（只存储日期数据不存储时间数据）</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 141pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">java.sql.Time</p></td><td style="margin: 0px; padding: 0px; width: 282pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">时分秒</p></td></tr><tr style="margin: 0px; padding: 0px; height: 18pt;"><td style="margin: 0px; padding: 0px; width: 141pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 6pt; font-family: Times New Roman, serif; font-size: 9pt;">java.sql.Timestamp</p></td><td style="margin: 0px; padding: 0px; width: 282pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 5pt; font-family: 宋体; font-size: 9pt;">年月日时分秒纳秒（毫微秒）</p></td></tr></tbody></table></div> </td>
        </tr>
        <tr>
          <td class="col0">3.2.7 创建主模块类</td>
          <td class="col1"><ul id="l9" style="margin: 0px; padding: 0px 0px 0px 0pt; font-family: microsoft yahei; font-size:16px"><li style="margin: 0px; padding: 1pt 0px 0px 47pt; text-indent: -21pt; display: block; text-align: left;"><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">作为项目启动时的入口，<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Nutz&nbsp;</span>项目的主模块类类似于&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Java&nbsp;</span>应用程序的主函数&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">main</span>，是程 序的入口函数。</p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">任何一个类都可以作为主模块，只要在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">web.xml&nbsp;</span>内正确配置即可。通常将主模块类命名为&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">MainModule</span>，见名知义。在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">cn.lrw.newsnutz&nbsp;</span>包中创建名称（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Name</span>）为&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">MainModule&nbsp;</span>的主模块 类（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Class</span>），如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">3-12&nbsp;</span>所示。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 94pt; text-indent: 0px; font-family: times new roman serif; font-size: 9pt" line-height:="" 10pt="" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_027.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 21pt; text-indent: 0px; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">3-12&nbsp;</span>创建主模块类&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">MainModule</span></p><p class="s6" style="margin: 0pt; padding: 7pt 0px 0px 26pt; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">MainModule&nbsp;<span class="s5" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 18px;">类生成后，在类的前面添加注解，如图&nbsp;</span>3-13&nbsp;<span class="s5" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 18px;">所示。</span></p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 39pt; text-indent: 0px; font-family: times new roman serif; font-size: 9pt" line-height:="" 10pt="" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_028.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 42pt; text-indent: 0px; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">3-13&nbsp;</span>主模块类&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">MainModule&nbsp;</span>及注解</p><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 26pt; text-indent: 0px; font-family: 宋体; font-size: 18px;"></p><p><span style="font-family:宋体;">当前项目主模块</span>MainModule<span style="font-family:宋体;">类前面使用的注解：</span></p><p>(1)<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:#646464;">@SetupBy</span>(value=MainSetup.<strong><span style="color:#7F0055;">class</span></strong>)<span style="font-family:宋体;">，需要新建一个类，类名可以是</span>MainSetup<span style="font-family:宋体;">，实现</span>Setup<span style="font-family:宋体;">接口，在</span>MainSetup<span style="font-family:宋体;">类中，实现整个项目系统启动或者关闭时的一些额外处理工作，如初始化数据库、关闭</span>mysql<span style="font-family:宋体;">线程等。</span></p><p>(2)<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:#646464;">@Modules</span>(scanPackage=<strong><span style="color:#7F0055;">true</span></strong>)<span style="font-family:宋体;">，将自动搜索主模块所在的包（包括子包）下所有的类。</span></p><p>(3)<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#646464;">@IocBy</span>(type=ComboIocProvider.<strong><span style="color:#7F0055;">class</span></strong>, args={<span style="color:#2A00FF;">&quot;*js&quot;</span>, <span style="color:#2A00FF;">&quot;ioc/&quot;</span>,<span style="color:#2A00FF;">&quot;*anno&quot;</span>, <span style="color:#2A00FF;">&quot;cn.lrw.newsnutz&quot;</span>, <span style="color:#2A00FF;">&quot;*tx&quot; </span>})<span style="font-family:宋体;">，设置应用所采用的</span> Ioc <span style="font-family:宋体;">容器。</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>ComboIocProvider<span style="font-family:宋体;">的</span>args<span style="font-family:宋体;">参数</span>, <span style="font-family:宋体;">星号开头的是类名或内置缩写</span>,<span style="font-family:宋体;">剩余的是各加载器的参数</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>*js <span style="font-family:宋体;">是</span>JsonIocLoader,<span style="font-family:宋体;">负责加载</span>js/json<span style="font-family:宋体;">结尾的</span>ioc<span style="font-family:宋体;">配置文件</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>*anno <span style="font-family:宋体;">是</span>AnnotationIocLoader,<span style="font-family:宋体;">负责处理注解式</span>Ioc, <span style="font-family:宋体;">例如</span>@IocBean</p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>*tx <span style="font-family:宋体;">是</span>TransIocLoader,<span style="font-family:宋体;">负责加载内置的事务拦截器定义</span></p><p>(4)<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span><span style="font-size:10.0pt;font-family:'Times New Roman','serif';color:#646464;">@Views</span><span style="font-size:10pt;font-family:'Times New Roman', serif;">({BeetlViewMaker.</span><strong><span style="font-size:10.0pt;font-family:'Times New Roman','serif';color:#7F0055;">class</span></strong><span style="font-size:10pt;font-family:'Times New Roman', serif;">})</span><span style="font-size:10.0pt;">，指定采用Beetl模板渲染视图。</span><span style="font-size:10.0pt;font-family:宋体;">能够用在主模块上的注解，如表</span><span style="font-size:10.0pt;font-family:'Times New Roman','serif';">3-6</span><span style="font-size:10.0pt;font-family:宋体;">所示。</span></p></li><li style="margin: 0px; padding: 1pt 0px 0px 47pt; text-indent: -21pt; display: block; text-align: left;"><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 26pt; text-indent: 0px; font-family: 宋体; font-size: 18px;"><br /></p></li><li style="margin: 0px; padding: 1pt 0px 0px 47pt; text-indent: -21pt; display: block; text-align: left;"><p class="s14" style="margin: 0pt; padding: 8pt 0px 0px 5pt; text-indent: 0px; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">表&nbsp;<span class="s15" style="margin: 0px; padding: 0px; font-family: Arial, sans-serif; font-size: 9pt;">3-6&nbsp;</span>主模块上支持的注解</p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><div style="margin:0 auto;width: 900px;"><table cellspacing="0" style="margin: 0px 0px 0px 5.294pt; padding: 0px; text-indent: 0px; vertical-align: top; overflow: visible; border-collapse: collapse;"><tbody style="margin: 0px; padding: 0px; vertical-align: top; overflow: visible;"><tr style="margin: 0px; padding: 0px; height: 18pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s16" style="margin: 0pt; padding: 1pt 0px 0px 25pt; font-family: 黑体, monospace; font-size: 9pt;">注 解</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s16" style="margin: 0pt; padding: 1pt 0px 0px; font-family: 黑体, monospace; font-size: 9pt; text-align: center;">说 明</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@Modules</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">整个应用有哪些子模块，子模块不能再嵌套子模块</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@IocBy</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">整个应用应采用何种方式进行反转注入。如果没有声明，整个应用将不支持&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: times new roman serif; font-size: 9pt">Ioc</span></p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@Localization</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">整个应用的本地化字符串的目录</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@SetupBy</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">应用启动和关闭时，应该进行的处理</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@Views</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">扩展整个应用支持的视图模板类型</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@Ok</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">整个应用默认的成功视图</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@Fail</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">整个应用默认的失败视图</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@AdaptBy</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">整个应用默认的&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: times new roman serif; font-size: 9pt">HTTP&nbsp;</span>参数适配方式</p></td></tr><tr style="margin: 0px; padding: 0px; height: 17pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@Filters</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">整个应用默认的过滤器数组</p></td></tr><tr style="margin: 0px; padding: 0px; height: 18pt;"><td style="margin: 0px; padding: 0px; width: 77pt; border-top-style: solid; border-top-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt; border-right-style: solid; border-right-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px 3pt; font-family: times new roman serif; font-size: 9pt">@Encoding</p></td><td style="margin: 0px; padding: 0px; width: 346pt; border-top-style: solid; border-top-width: 1pt; border-left-style: solid; border-left-width: 1pt; border-bottom-style: solid; border-bottom-width: 1pt;"><p class="s18" style="margin: 0pt; padding: 0px 0px 0px 2pt; font-family: 宋体; font-size: 9pt;">整个应用默认的输入输出字符编码</p></td></tr></tbody></table></div></li></ul>  </td>
        </tr>

        <tr>
          <td class="col0">3.2.8 实现Setup接口</td>
          <td class="col1"><ul id="l9" style="margin: 0px; padding: 0px 0px 0px 0pt; font-family: microsoft yahei; font-size:16px"><li style="margin: 0px; padding: 1pt 0px 0px 47pt; text-indent: -21pt; display: block; text-align: left;"><ol id="l16" style="margin: 0px; padding: 0px 0px 0px 0pt; text-indent: 0px; counter-reset: h1 3;"><ol id="l17" style="margin: 0px; padding: 0px 0px 0px 0pt; counter-reset: h2 2;"><ol id="l18" style="margin: 0px; padding: 0px 0px 0px 0pt; counter-reset: h3 7;"><li style="margin: 0px; padding: 1pt 0px 0px 60pt; text-indent: -33pt; display: block; text-align: left;"><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 15.82px;">在整个应用启动或者关闭时，通常可以让系统做一些额外的处理工作，如读取配置文件、 初始化数据库等。在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">cn.lrw.newsnutz&nbsp;</span>包中新建&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">MainSetup&nbsp;</span>类，实现&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Setup&nbsp;</span>接口，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">3-14&nbsp;</span>所示。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_029.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p style="margin: 0pt; padding: 3pt 0px 0px 221pt; text-indent: 0px; font-family: times new roman serif; font-size: 9pt" text-align:="" center=""><span style="font-family: 宋体; font-size: 9pt;">图&nbsp;</span><span class="p" style="font-size: 9pt; margin: 0pt; padding: 0px;">3-14&nbsp;</span><span style="font-family: 宋体; font-size: 9pt;">创建&nbsp;</span><span class="p" style="font-size: 9pt; margin: 0pt; padding: 0px;">MainSetup&nbsp;</span><span style="font-family: 宋体; font-size: 9pt;">类</span><br /></p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"></p><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>MainSetup<span style="font-family:宋体;">类中初始化数据库，如果</span>user<span style="font-family:宋体;">表没有用户数据，则添加一条默认的用户信息：</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">用户名</span>2953<span style="font-family:宋体;">，实际为登录用户名</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">姓名</span>lrw</span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">密码</span>123<span style="font-family:宋体;">，后期再运用</span>shiro<span style="font-family:宋体;">进行加密处理，提升安全性能。</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#444444;">public</span></strong><span style="color:#444444;"> <strong>class</strong> </span><strong><span style="color:#880000;">MainSetup</span></strong><span style="color:#444444;"><strong>implements</strong> </span><strong><span style="color:#880000;">Setup</span></strong><span style="color:#444444;"> {</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;"> @Override </span></span></p><p><span style="font-size:18px;"><span style="color:#444444;"> <strong>public void</strong> </span><strong><span style="color:#880000;">init</span></strong><span style="color:#444444;">(NutConfigarg0) {</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ioc ioc = arg0.getIoc();</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dao dao = ioc.get(Dao.class);</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Daos.createTablesInPackage(dao, </span><span style="color:#880000;">&quot;cn.lrw.newsnutz.pojo&quot;</span><span style="color:#444444;">, <strong>false</strong>);</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#888888;">// </span><span style="font-family:宋体;color:#888888;">初始化默认根用户</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>if</strong> (dao.count(User.class) == </span><span style="color:#880000;">0</span><span style="color:#444444;">){</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; User user = <strong>new</strong> User();</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user.setUid(</span><span style="color:#880000;">&quot;2953&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user.setXm(</span><span style="color:#880000;">&quot;lrw&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user.setPwd(</span><span style="color:#880000;">&quot;123&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user.setRole(</span><span style="color:#880000;">&quot;1&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dao.insert(user);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">} </span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">@Override</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;"> <strong>public void</strong> </span><strong><span style="color:#880000;">destroy</span></strong><span style="color:#444444;">(NutConfigarg0) {</span><span style="color:#888888;">// webapp</span><span style="font-family:宋体;color:#888888;">销毁之前执行的逻辑</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;"> } </span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">}</span></span></p><span style="font-size:18px;"><br style="margin: 0px; padding: 0px;" /></span><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 2pt; text-indent: 0px; font-family: 宋体; font-size: 18px;"><br /></p></li></ol></ol></ol></li></ul>  </td>
        </tr>
        <tr>
          <td class="col0">3.2.9 配置web.xml</td>
          <td class="col1"><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;"></p><p><span style="font-family:宋体;">打开</span>web.xml<span style="font-family:宋体;">文件，在</span>display-name<span style="font-family:宋体;">节点和</span>welcome-file-list<span style="font-family:宋体;">节点之间，添加</span>nutz<span style="font-family:宋体;">的</span>filter<span style="font-family:宋体;">，根据实际情况正确设置</span>NutFilter<span style="font-family:宋体;">的</span>modules<span style="font-family:宋体;">参数值为主模块的包</span><strong><span style="color:red;">cn.lrw.newsnutz.MainModule</span></strong></p><p><img th:src="@{/assets/javaeeimg/591f8ecd525040c69911a5d5eaa19233.png}" align="middle" alt="" /><br /></p><p><br /></p>  </td>
        </tr>
        <tr>
          <td class="col0">3.2.10 简单的系统首页</td>
          <td class="col1"><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 26pt; font-family: 宋体; font-size: 18px;">在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">WebRoot&nbsp;</span>目录单击右键，选择新建&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">HTML</span>，创建一个名为&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">index.html&nbsp;</span>的首页，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">3-15</span></p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; font-family: 宋体; font-size: 18px;">所示。页面内容自定，可以默认，如果原来有&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: Times New Roman, serif; font-size: 18px;">index.jsp</span>，可以删除。</p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 90pt; font-family: Times New Roman, serif; font-size: 9pt; line-height: 10pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_030.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 5pt 0px 0px 5pt; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">3-15&nbsp;</span>新建首页&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">index.html</span></p> </td>
        </tr>
        <tr>
          <td class="col0">3.2.11 运行项目</td>
          <td class="col1"><ul id="l9" style="margin: 0px; padding: 0px 0px 0px 0pt; font-family: microsoft yahei; font-size:16px"><li style="margin: 0px; padding: 1pt 0px 0px 47pt; text-indent: -21pt; display: block; text-align: left;"><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">运行基于&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Nutz&nbsp;</span>框架的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">JavaEE&nbsp;</span>项目。如果控制台&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">console&nbsp;</span>没有报错信息（出现&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Exception&nbsp;</span>字样），则在浏览器可以看到正常的首页信息，数据库中可以看到写入的用户信息，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">3-16&nbsp;</span>所示。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 91pt; text-indent: 0px; font-family: times new roman serif; font-size: 9pt" line-height:="" 10pt="" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_031.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 47pt; text-indent: 0px; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">3-16&nbsp;</span>初始化数据库结果</p><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 26pt; text-indent: 0px; font-family: 宋体; font-size: 18px;">首次运行，右键单击项目名称&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">newsnutz</span>，选择&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Run As&nbsp;</span>中的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Myeclipse Server Application</span></p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 0px; font-family: 宋体; font-size: 18px;">命令，运行完成的项目，可以看到项目的运行状态，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">3-17&nbsp;</span>和图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">3-18&nbsp;</span>所示。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 31pt; text-indent: 0px; font-family: times new roman serif; font-size: 9pt" line-height:="" 10pt="" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_032.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 5pt 0px 0px 5pt; text-indent: 0px; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">3-17 Myeclipse Server&nbsp;</span>运行状态</p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 62pt; text-indent: 0px; font-family: times new roman serif; font-size: 9pt" line-height:="" 10pt="" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_033.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 5pt; text-indent: 0px; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">3-18&nbsp;</span>控制台&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">console&nbsp;</span>信息</p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 15.26px;">在浏览器中输入&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">http://localhost:8080/newsnutz&nbsp;</span>回车，如果能在浏览器中看到自己设定的首 页，则说明系统运行正常，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">3-19&nbsp;</span>所示。</p><p style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 125pt; text-indent: 0px; font-family: times new roman serif; font-size: 9pt" line-height:="" 10pt="" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_034.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 21pt; text-indent: 0px; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">3-19&nbsp;</span>简单的默认首页</p><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;">项目运行中，应<span style="text-indent: 21pt;">学会查看</span><span style="text-indent: 21pt;">console</span><span style="text-indent: 21pt;">中的信息，看是否存在报错信息，排除存在的问题，比如：</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>MainModule<span style="font-family:宋体;">参数出错</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span><span style="font-family:宋体;">数据库配置信息有误</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>jar<span style="font-family:宋体;">包没有添加到正确的目录中</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>web.xml<span style="font-family:宋体;">中参数不正确</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>server.xml<span style="font-family:宋体;">配置错误</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span>MainSetup<span style="font-family:宋体;">中提前使用了加密方法</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span><span style="font-family:宋体;">启动</span>Tomcat<span style="font-family:宋体;">时，提示</span><span style="color:#0070C0;">Can’t loadAMD 64-bit .dll on a IA 32-bit platform</span><span style="font-family:宋体;">，表示目前使用</span>64<span style="font-family:宋体;">位</span>Tomcat<span style="font-family:宋体;">，</span>32<span style="font-family:宋体;">位</span>JDK<span style="font-family:宋体;">，重新安装</span>64<span style="font-family:宋体;">位</span>JDK<span style="font-family:宋体;">即可。</span></p></li></ul>  </td>
        </tr>

		</tbody>
    </table>
<div th:include="include :: footer"></div>
</body>
</html>
